import request from '@/utils/request'

/**
 * 字典下拉列表
 * @param typeCode
 */
export function fetchDictSelectList(data?: any) {
  return request({
    url: '/zgyp-system/api/v1/dict/listOptions',
    method: 'post',
    data,
  })
}

export function fetchDictTypesList(params?: any) {
  return request({
    url: '/zgyp-system/api/v1/dict/types/page',
    method: 'get',
    params,
  })
}

export function addDictType(data: any) {
  return request({
    url: '/zgyp-system/api/v1/dict/types',
    method: 'post',
    data,
  })
}

export function addDict(data: any) {
  return request({
    url: '/zgyp-system/api/v1/dict',
    method: 'post',
    data,
  })
}
export function updateDictType(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dict/types/${data.id}`,
    method: 'put',
    data,
  })
}

export function deleteDictType(params?: any) {
  return request({
    url: `/zgyp-system/api/v1/dict/types/${params.ids}`,
    method: 'delete',
    params,
  })
}

export function fetchDictList(params?: any) {
  return request({
    url: '/zgyp-system/api/v1/dict/page',
    method: 'get',
    params,
  })
}

export function deleteDict(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dict/${data.ids}`,
    method: 'delete',
    data,
  })
}

export function editDict(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dict/${data.id}`,
    method: 'put',
    data,
  })
}
